import React, { useState } from 'react'
import { useDispatch } from 'react-redux'
import { useNavigate } from 'react-router-dom'
import { NavBar } from 'react-vant'
import { ResultPage } from 'antd-mobile'
import { createFromIconfontCN } from '@react-vant/icons'

const IconFont = createFromIconfontCN(
    '//at.alicdn.com/t/c/font_3954496_49mkhdd73iq.js'
)
export default function Success() {
    const [time, settime] = useState('')
    function gettime() {
        let now = new Date()
        let hour = now.getHours()
        let minute = now.getMinutes()
        let second = now.getSeconds()
        settime(hour + ':' + minute)
        return hour + ':' + minute + ':' + second

    }

    setInterval(gettime, 1000);

    const right = () => {
        return <div style={{ display: 'flex', width: '50px', justifyContent: 'space-around', fontSize: '18px' }}>
            <IconFont name='icon-wuxianwangluo' />
            <IconFont name='icon-electricity-full' />
        </div>
    }


    const navigate = useNavigate()
    return (
        <div className='sucss' style={{
            width: '100%',
            height: '100vh',
            // position: 'static', // 防止页面滚动被遮盖
        }}
        >
            <div className="pre">
                <NavBar
                    title=""
                    leftText={time}
                    rightText={right()}
                    onClickLeft={() => navigate(-1)}
                />
            </div>
            <div style={{ textAlign: 'center', marginTop: '60px' }}>
                <IconFont style={{ fontSize: '100px' }} name='icon-chenggong' />
                <br />
                <span style={{ fontSize: "17px", marginTop: '17px' }}>支付成功</span>
            </div>
            <div style={{
                width: '100%',
                textAlign: 'center',
                marginTop: '100px'
            }}>

                <button style={{
                    width: '80%',
                    backgroundColor: 'red',
                    color: 'white',
                    border: 'none',
                    height: '40px',
                    lineHeight: '40px',
                    borderRadius: '20px',

                }} onClick={() => {
                    navigate('/user/order')
                }}>
                    查看订单
                </button>
            </div>


        </div >
    )
}
